<template>
	<view style="width: 100%;height: 100%;position: relative;">
		<div id="my_note">
			<div class="nav">
				<ul class="am-avg-sm-4">
					<li><a class="cur" @click="uni.redirectTo({
						url:'trip_comment'
					})">游记评论</a></li>
					<li><a @click="uni.redirectTo({
						url:'my_project_comment'
					})">活动评论</a></li>
					<li><a @click="uni.redirectTo({
						url:'check'
					})">游记待审核</a></li>
					<li><a @click="uni.redirectTo({
						url:'nopass'
					})">审核不通过</a></li>
				</ul>
			</div>
			<div id="app">
				<div class="cont">
					<ul v-for="b in comment">
						<li>
							<div class="box_cont">
								<a title="" @click="itemClicked(b)">
									<div class="pic">
										<img :src="'https://yo.docshare.org.cn'+b.user_photo">
									</div>
									<div class="project_cont">
										<p>{{b.comment}}</p>
									</div>
									<div class="clear"></div>
									{{b.commentdate}}
								</a>
							</div>
							<span class="date">{{b.articletitle_comment}}</span>
							<div class="button">
								<input type="submit" class="input" @click="delete1(b)" value="删除" />
							</div>
						</li>
					</ul>
					<div id="none">
						没有更多了
					</div>
				</div>
			</div>
		</div>
		<div id="footer">
			<div class="first">
				<ul class="am-avg-sm-2">
					<li class="active">
						<a title="" @click="uni.navigateTo({
							url:'index'
						})">
							<img src="https://yo.docshare.org.cn/static/images/icon-footer01-a.png" />
							<p>首页</p>
						</a>
					</li>
					<li>
						<a title=""  @click="uni.navigateTo({
							url:'../../pageA/pages/active/trip_list'
						})">
							<img alt=""  src="https://yo.docshare.org.cn/static/images/icon-footer4-a.png" />
							<p>活动</p>
						</a>
					</li>
				</ul>
			</div>
			<div class="beautiful">
				<a title=""  @click="uni.navigateTo({
					url:'../add/my_note'
				})">
					<img alt="" src="https://yo.docshare.org.cn/static/images/icon-footer3-a.png" />
				</a>
			</div>
			<div class="last">
				<ul class="am-avg-sm-2">
					<li>
						<a title="" @click="uni.navigateTo({
							url:'../map/map'
						})">
							<img alt=""  src="https://yo.docshare.org.cn/static/images/icon-footer2-a.png"/>
							<p>地图</p>
						</a>
					</li>
					<li>
						<a title="" @click="uni.navigateTo({
							url:'../../pageB/pages/user/user_center'
						})">
							<img alt="" src="https://yo.docshare.org.cn/static/images/icon-footer5-a.png" />
							<p>我的</p>
						</a>
					</li>
				</ul>
			</div>
		</div>
	</view>
</template>

<script>
	import config from '@/config'
	export default {
		data() {
			return {
				uni,
				config,
				aid: '',
				comment: {},
				id: ''
			}
		},
		methods: {
			itemClicked: function(item) {
				uni.navigateTo({
					url: `beautiful_detail?id=${item.article_id}`,
				})
			},
			delete1: function(item) {
				this.id = item.id;
				uni.request({
					url: `${config.baseUrl}/article/deletewithmearticle?token=` + uni.getStorageSync('token'),
					method: 'POST',
					success(r) {
						if (r.data.succ) {
							uni.navigateTo({
								url:'trip_comment'
							})
						} else {

						}
					},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
				});
			},
		},
		onLoad() {
			var that = this;
			uni.request({
				url: `${config.baseUrl}/article/withmearticle?token=` + uni.getStorageSync('token'),
				method: 'GET',
				success(r) {
					if (r.data.succ) {
						that.comment = r.data.data;

					} else {
						// 可以给个弹窗提示
					}
				},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
			});
			uni.request({
				url: `${config.baseUrl}/article/list?token=` + uni.getStorageSync('token'),
				method: 'GET',
				success(r) {
					if (r.data.succ) {
						that.articles = r.data.data;

					} else {
						// 可以给个弹窗提示
					}
				}
			});
		}
	}
</script>

<style>
</style>
